'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const ObjectId = Schema.ObjectId;

  const OrderSchema = new Schema({
    code: { type: String },
    order_type: { type: String },
    order_biz_type: { type: String },
    user_id: { type: ObjectId },
    expert_id: { type: ObjectId },
    amount: { type: Number },
    state: { type: String },
    create_at: { type: Date, default: Date.now },
    update_at: { type: Date, default: Date.now },
  });

  return mongoose.model('Order', OrderSchema);
};